<?php
/**
 * Created by PhpStorm.
 * User: 尧
 * Date: 11/20/2016
 * Time: 8:25 PM
 */
namespace frontend\controllers;
use yii\web\Controller;
class ApiController extends Controller{
    public function actionPage(){
        return $this->render('page');
    }

    public function actionAjax(){
//        数据结构(纯粹响应数据)
        \Yii::$app->getResponse()->format = \yii\web\Response::FORMAT_JSON;
        return ['user'=>'HelloYao', 'age'=>'30'];
        //夹杂了业务逻辑
        //不渲染布局模板
//        return $this->renderPartial('ajax',['user'=>'HelloYao', 'age'=>'30']);
    }


}